package com.zxy.supplier_system.server.repository

import com.zxy.supplier_system.server.entity.CheckInventoryRecordItem
import com.zxy.supplier_system.server.entity.SystemService
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository

@Suppress("FunctionName")
interface CheckInventoryRecordItemRepository :
    JpaRepository<CheckInventoryRecordItem, Int> {

    fun findAllByRecord_IdOrderBySequenceAsc(reocrd_id: Int, pageable: Pageable): Page<CheckInventoryRecordItem>

    fun existsByRecord_IdAndGoods_Id(reocrd_id: Int, goods_id: Int): Boolean

    fun existsByRecord_IdAndGoods_Barcode(reocrd_id: Int, goods_barcode: String): Boolean;

    fun findByGoods_SystemServiceAndGoods_IdAndRecord_IdAndSubGoods_Id(systemService: SystemService,goodsId: Int,reocrd_id: Int,subGoodsId: Int?): CheckInventoryRecordItem?

    fun deleteByRecord_IdAndGoods_IdAndGoods_SystemServiceAndSubGoods_Id(
        record_id: Int,
        goods_id: Int,
        goods_systemService: SystemService,
        subGoodsId: Int?,
    )

}
